
_realname=python-sphinx-lv2-theme
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.4.0
pkgrel=2
pkgdesc="A minimal static theme for Sphinx (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://gitlab.com/lv2/sphinx_lv2_theme"
license=("spdx:ISC")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-build"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
  "${MINGW_PACKAGE_PREFIX}-python-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python-wheel"
)
depends=("${MINGW_PACKAGE_PREFIX}-python-sphinx")
source=("https://files.pythonhosted.org/packages/source/s/sphinx_lv2_theme/sphinx_lv2_theme-${pkgver}.tar.gz")
sha256sums=('68834c4ff84da0e60e2fa8ebe87e83ceb8e5f5ad407d706d3b0e88c6958a92e5')

build() {
  [[ -d "build-${MSYSTEM}" ]] && rm -rf "build-${MSYSTEM}"
  mkdir -p "${srcdir}/build-${MSYSTEM}"
  cd "${srcdir}/build-${MSYSTEM}"

  ${MINGW_PREFIX}/bin/python.exe \
    -m build \
    --wheel \
    --no-isolation \
    --outdir . \
    ../sphinx_lv2_theme-${pkgver}
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python.exe -m installer \
      --prefix="${MINGW_PREFIX}" \
      --destdir="${pkgdir}" *.whl

  install -vDm 644 ${srcdir}/sphinx_lv2_theme-${pkgver}/LICENSE -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/"
  install -vDm 644 ${srcdir}/sphinx_lv2_theme-${pkgver}/{NEWS,README.md} -t "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}/"
}
